package com.stwyj.sbd.task;

import com.stwyj.sbd.entity.dto.UserDto;
import com.stwyj.sbd.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

/**
 *<p>
 * demo定时任务
 *</p>
 *
 * @author stwyj
 * @since 2018/11/30
 */
//@Component
@Slf4j
public class DemoTask {

    @Resource
    private UserService userService;

    @Scheduled(fixedDelay = 30000)
    public void demo() {
        log.info("开始执行");

        log.info("用户信息为：{}", userService.getUser(UserDto.builder().id(1).name("a").build()));

        log.info("执行结束");
    }
}
